# -*- coding:utf-8 -*-
# !/usr/bin/python3

import itertools


class Cartesian:
    def __init__(self):
        self._data_list = []

    # 添加生成笛卡尔积的数据列表
    def add_data(self, data=None):
        if data is None:
            data = []
        self._data_list.append(data)

    # 计算笛卡尔积
    def build(self):
        result = []
        for item in itertools.product(*self._data_list):
            result.append(list(item))
        return result
